Add timeout with default action for turn-based casino games#353
Draft
Add timeout with default action for turn-based casino games#353
Conversation
Co-authored-by: Pierre-Demessence <[email protected]>
Copilot
AI
changed the title
[WIP] Add timeout with default Action
Add timeout with default action for turn-based casino games
Jul 26, 2025
- 🔄 Refactored time display logic to use a relative timestamp format. - ⏳ Removed previous time formatting conditions for clarity. - 📅 Added calculation for end date based on current player's turn start time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements automatic timeout functionality for turn-based casino games to prevent games from stalling indefinitely when players become inactive.
Changes Made
Core Features
GameSession)Technical Implementation
IGameSessioninterface andGameSession<T>class with timeout properties:PlayerTurnTimeout: Configurable timeout duration (default 2 minutes)CurrentPlayerTurnStartTime: Tracks when current player's turn beganTimeRemaining: Calculates remaining time for current playerIsCurrentPlayerTimedOut: Determines if current player has exceeded timeoutGetDefaultAction()method toACasinoGame<T>base classGameTimeoutServiceas a background service registered in the DI containerUser Experience
The timeout feature integrates seamlessly with existing gameplay:
After timeout, the default action is performed automatically and the game continues normally. AI players are excluded from timeouts as they act immediately.
Files Changed
GameTimeoutServiceand updatedGameServiceCasinoSlashModuleto track turn timingProgram.csThe implementation maintains backward compatibility and follows the existing architecture patterns. Games that are already in progress will continue working normally, with timeout functionality applying to new games.
Fixes #348.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.